/*
* Copyright 2018 Shanxi Lu'an Taihang Laihui Net Tech co.,LTD.
*/
package com.laihuichuxing.state;/**
 * Description:
 *
 * @author: Qinxuefeng
 * @since: 1.0
 * Create Date Time: 2019/1/3 15:25
 * Update Date Time:
 */

public abstract class State {
    protected abstract void handle(Context context);
}
class ConcreteStateA extends State{
    @Override
    protected void handle(Context context) {
        System.out.println("现在状态A");
        context.setState(new ConcreteStateB());
    }
}
class ConcreteStateB extends State{
    @Override
    protected void handle(Context context) {
        System.out.println("现在状态B");
        context.setState(new ConcreteStateC());
    }
}
class ConcreteStateC extends State{
    @Override
    protected void handle(Context context) {
        System.out.println("现在状态C");
        context.setState(new ConcreteStateA());
    }
}
